package com.zpark.jsoup;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;

/**
 * @PackageName: com.zpark.jsoup
 * @ClassName: Demo05
 * @Description: 获取网页中的所有链接
 * @author: RZS
 * @date: 2021/8/15  23:37
 */
public class Demo05 {
    public static void main(String[] args) throws IOException {
        Document document = Jsoup.connect("https://y.qq.com").get();
        Elements elements = document.select("a[href]");
        for (Element element : elements) {
            System.out.println("连接地址："+element.attr("href"));
            System.out.println("连接名字："+element.text());
        }
    }
}
